<?php
include("config.php");
include("core.php");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml'); 
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$bcon = connectdb();
if (!$bcon)
{
    echo "<head>";
    echo "<title>Error!!!</title>";
    echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
    echo "</head>";
    echo "<body>";
    echo "<p align=\"center\">";
    echo "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
    echo "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
    echo "This error happens usually when backing up the database, please be patient...";
    echo "</p>";
    echo "</body>";
    echo "</html>";
    exit();
}
$brws = explode("/",$HTTP_USER_AGENT);
$ubr = $brws[0];
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$uid = getuid_sid($sid);
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
cleardata();

if(($action != "") && ($action!="terms"))
{
    $uid = getuid_sid($sid);
    if((islogged($sid)==false)||($uid==0))
    {
      echo "<head>";
      echo "<title>Error</title>";
      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo "</head>";
      echo "<body>";
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "<a href=\"index.php\">Login</a>";
      echo "</p>";
      echo "</body>";
      echo "</html>";
      exit();
    }
}
////////////////////////////////////////MAIN PAGE
$amount = $_POST["amount"];
$whonick = $_GET["whonick"];
if($action=="giveplus")
{
  echo "<head>";
  echo "<title>Give Plusses</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
echo "<strong>Giving Plusses To $whonick <strong>";
echo "<b>Remeber if you give to many plusses features like shouting wont be available</b><br/>plusses will not be returned by staff<br/>";
echo "<form action=\"loony.php?action=give&amp;whonick=$whonick&amp;sid=$sid\" method=\"post\">";
echo "Amount: <input name=\"amount\" style=\"-wap-input-format: '*N'\" maxlength=\"3\"/><br/>";
  echo "<input type=\"hidden\" name=\"who\" value=\"$whonick\"/>";
  echo "<input type=\"Submit\" value=\"Give\" Name=\"Submit\"/></form>";
    echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
	echo "</body></html>";
    exit();
    }
elseif ($action=="give")
{
$amount = $_POST["amount"];
$whonick = $_GET["whonick"];
 echo "<head>";
  echo "<title>Give Plusses</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  echo "<b>Thank You</b><br/>";
  echo "You Have Given $amount Plusses To $whonick<br/>";
  mysql_query("UPDATE ibwf_users SET plusses='".$amount."' WHERE id='".$whonick."'");  
     $plusses = mysql_fetch_array(mysql_query("SELECT plusses, name FROM ibwf_users WHERE id='".$who."'"));
	$remainplus = $plusses[0] - $amount;
	$plussupdate = mysql_query("UPDATE ibwf_users SET plusses='".$remainplus."' WHERE id='".$who."'");
      echo "<a href=\"index.php?action=main&amp;sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
	echo "</body></html>";
    exit();
    }else{
	echo "<head>";
  echo "<title>Give Plusses</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  echo "Your not even worth the effort<br/>";
   echo "</p></body>";
}
?>
</html>
 
  